<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module swc_vv</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>

<h1>Module swc_vv</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
     An Erlang implementation of a Version Vector.

<p><b>Authors:</b> Ricardo Gonçalves (<a href="mailto:tome.wave@gmail.com"><tt>tome.wave@gmail.com</tt></a>).</p>

<h2><a name="description">Description</a></h2>
     An Erlang implementation of a Version Vector.
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add-2">add/2</a></td><td>Adds an entry {Id, Counter} to the VV, performing the maximum between
  both counters, if the entry already exists.</td></tr>
<tr><td valign="top"><a href="#delete_key-2">delete_key/2</a></td><td>Returns the VV without the entry with a given key.</td></tr>
<tr><td valign="top"><a href="#filter-2">filter/2</a></td><td>It applies some boolean function F to all entries in the VV, removing
  those that return False when F is used.</td></tr>
<tr><td valign="top"><a href="#get-2">get/2</a></td><td>Returns the counter associated with an id K.</td></tr>
<tr><td valign="top"><a href="#ids-1">ids/1</a></td><td>Returns all the keys (ids) from a VV.</td></tr>
<tr><td valign="top"><a href="#join-2">join/2</a></td><td>Merges or joins two VVs, taking the maximum counter if an entry is
  present in both VVs.</td></tr>
<tr><td valign="top"><a href="#min-1">min/1</a></td><td>Returns the minimum counters from all the entries in the VV.</td></tr>
<tr><td valign="top"><a href="#min_key-1">min_key/1</a></td><td>Returns the key with the minimum counter associated.</td></tr>
<tr><td valign="top"><a href="#new-0">new/0</a></td><td>Initializes a new empty version vector.</td></tr>
<tr><td valign="top"><a href="#reset_with_same_ids-1">reset_with_same_ids/1</a></td><td>Returns the VV with the same entries, but with counters at zero.</td></tr>
</table>

<h2><a name="functions">Function Details</a></h2>

<h3 class="function"><a name="add-2">add/2</a></h3>
<div class="spec">
<p><tt>add(VV::<a href="#type-vv">vv()</a>, X2::{<a href="#type-id">id()</a>, <a href="#type-counter">counter()</a>}) -&gt; <a href="#type-vv">vv()</a></tt><br></p>
</div><p>Adds an entry {Id, Counter} to the VV, performing the maximum between
  both counters, if the entry already exists.</p>

<h3 class="function"><a name="delete_key-2">delete_key/2</a></h3>
<div class="spec">
<p><tt>delete_key(VV::<a href="#type-vv">vv()</a>, Key::<a href="#type-id">id()</a>) -&gt; <a href="#type-vv">vv()</a></tt><br></p>
</div><p>Returns the VV without the entry with a given key.</p>

<h3 class="function"><a name="filter-2">filter/2</a></h3>
<div class="spec">
<p><tt>filter(F::fun((<a href="#type-id">id()</a>, <a href="#type-counter">counter()</a>) -&gt; boolean()), V::<a href="#type-vv">vv()</a>) -&gt; <a href="#type-vv">vv()</a></tt><br></p>
</div><p>It applies some boolean function F to all entries in the VV, removing
  those that return False when F is used.</p>

<h3 class="function"><a name="get-2">get/2</a></h3>
<div class="spec">
<p><tt>get(K::<a href="#type-id">id()</a>, V::<a href="#type-vv">vv()</a>) -&gt; {ok, <a href="#type-counter">counter()</a>} | error</tt><br></p>
</div><p>Returns the counter associated with an id K. If the key is not present
  in the VV, it returns 0.</p>

<h3 class="function"><a name="ids-1">ids/1</a></h3>
<div class="spec">
<p><tt>ids(V::<a href="#type-vv">vv()</a>) -&gt; [<a href="#type-id">id()</a>]</tt><br></p>
</div><p>Returns all the keys (ids) from a VV.</p>

<h3 class="function"><a name="join-2">join/2</a></h3>
<div class="spec">
<p><tt>join(A::<a href="#type-vv">vv()</a>, B::<a href="#type-vv">vv()</a>) -&gt; <a href="#type-vv">vv()</a></tt><br></p>
</div><p>Merges or joins two VVs, taking the maximum counter if an entry is
  present in both VVs.</p>

<h3 class="function"><a name="min-1">min/1</a></h3>
<div class="spec">
<p><tt>min(VV::<a href="#type-vv">vv()</a>) -&gt; <a href="#type-counter">counter()</a></tt><br></p>
</div><p>Returns the minimum counters from all the entries in the VV.</p>

<h3 class="function"><a name="min_key-1">min_key/1</a></h3>
<div class="spec">
<p><tt>min_key(VV::<a href="#type-vv">vv()</a>) -&gt; <a href="#type-id">id()</a></tt><br></p>
</div><p>Returns the key with the minimum counter associated.</p>

<h3 class="function"><a name="new-0">new/0</a></h3>
<div class="spec">
<p><tt>new() -&gt; <a href="#type-vv">vv()</a></tt><br></p>
</div><p>Initializes a new empty version vector.</p>

<h3 class="function"><a name="reset_with_same_ids-1">reset_with_same_ids/1</a></h3>
<div class="spec">
<p><tt>reset_with_same_ids(VV::<a href="#type-vv">vv()</a>) -&gt; <a href="#type-vv">vv()</a></tt><br></p>
</div><p>Returns the VV with the same entries, but with counters at zero.</p>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, Oct 29 2015, 16:20:19.</i></p>
</body>
</html>
